package com.ts.api.http.platform.biz;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gitee.apanlh.util.algorithm.encrypt.symmetric.AES;
import com.gitee.apanlh.util.base.*;
import com.gitee.apanlh.util.dataformat.JsonUtils;
import com.gitee.apanlh.util.id.IdUtils;
import com.gitee.apanlh.util.valid.ValidParam;
import com.gitee.apanlh.web.model.vo.RequestVO;
import com.ts.api.http.platform.entity.apply.ApiPlatApplyYaoDaiQianBao;
import com.ts.api.http.platform.entity.dataexchange.ApiPlatDataExchangeYaoDaiQianBao;
import com.ts.api.module.api.convert.core.annotation.ApiPlan;
import com.ts.api.module.api.convert.core.annotation.ApiPlanConvertType;
import com.ts.api.module.api.convert.core.entity.ApiApplyParameter;
import com.ts.api.module.api.convert.core.entity.ApiBizStatus;
import com.ts.api.module.api.convert.core.entity.ApiDataExchangeParameter;
import com.ts.api.module.api.convert.platform.entity.*;
import com.ts.api.module.api.convert.platform.handler.ApiPlatformPhoneMaskConvertHandler;
import com.ts.api.module.api.entity.ApiProtocol;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 腰袋钱包
 *
 *全流程 - 文档：https://qqf25ufh3vl.feishu.cn/wiki/ILtXwQtnDidEoDk1L91cQRKvnAg?from=from_copylink
 *         密码：9&v99365
 *
 * @author gwc
 */
@ApiPlan(productId = "360", type = ApiPlanConvertType.PLAT_PHONE_MASK)
public class ApiPlatYaoDaiQianBaoPhoneMask implements ApiPlatformPhoneMaskConvertHandler {

    public static final String KEY = "aG3Lz5RsRWm9Bfwb";
    public static final String ACCESSKEY_ID = "anfqj";

    @Override
    public Object dataExchange(ApiDataExchangeParameter apiDataExchangeParameter) throws Exception {
        //  创建对应撞库实体类
        ApiPlatDataExchangeYaoDaiQianBao yaoDaiQianBaoData = new ApiPlatDataExchangeYaoDaiQianBao();

        yaoDaiQianBaoData.setAge(Integer.valueOf(apiDataExchangeParameter.getAge()));
        //  8位明文手机号,例13800000
        yaoDaiQianBaoData.setMaskPhone(apiDataExchangeParameter.getPhoneMask());
        //  渠道推广code
        yaoDaiQianBaoData.setChannelPromotionCode(ACCESSKEY_ID);
         //  性别 1男 2女
         Integer sex = ChooseEq.create()
                 .when(apiDataExchangeParameter.getSex(), "1", 2)
                 .when(apiDataExchangeParameter.getSex(), "0", 1)
                 .end(1);
        yaoDaiQianBaoData.setSex(sex);
        //  芝麻分额度 1.额度600分以下 2.额度600-650分 3.额度651-700分 4.额度700分以上
        Integer zhima = ChooseEq.create()
                .when(apiDataExchangeParameter.getSesameCredit(), "1", 1)
                .when(apiDataExchangeParameter.getSesameCredit(), "2", 2)
                .when(apiDataExchangeParameter.getSesameCredit(), "3", 3)
                .when(apiDataExchangeParameter.getSesameCredit(), "4", 4)
                .end(1);
        yaoDaiQianBaoData.setSesameSeedQuota(zhima);
        //  蚂蚁花呗额度 1.额度1000以下 2.额度1000-5000 3.额度5000-10000 4.额度10000以上 5.无
        Integer hbLimit = ChooseEq.create()
                .when(apiDataExchangeParameter.getHbLimit(), "1", 5)
                .when(apiDataExchangeParameter.getHbLimit(), "2", 1)
                .when(apiDataExchangeParameter.getHbLimit(), "3", 3)
                .when(apiDataExchangeParameter.getHbLimit(), "4", 4)
                .when(apiDataExchangeParameter.getHbLimit(), "5", 4)
                .end(5);
        yaoDaiQianBaoData.setAntCreditPayQuota(hbLimit);
        //  京东白条额度 1.额度1000以下 2.额度1000-5000 3.额度5000-10000 4.额度10000以上 5.无
        Integer btLimit = ChooseEq.create()
                .when(apiDataExchangeParameter.getBtLimit(), "1", 5)
                .when(apiDataExchangeParameter.getBtLimit(), "2", 1)
                .when(apiDataExchangeParameter.getBtLimit(), "3", 3)
                .when(apiDataExchangeParameter.getBtLimit(), "4", 4)
                .when(apiDataExchangeParameter.getBtLimit(), "5", 3)
                .end(5);
        yaoDaiQianBaoData.setJdBtQuota(btLimit);
        //  逾期 1.否 2.是
        Integer overdue = ChooseEq.create()
                .when(apiDataExchangeParameter.getOverdue(), "1", 1)
                .when(apiDataExchangeParameter.getOverdue(), "2", 2)
                .when(apiDataExchangeParameter.getOverdue(), "3", 1)
                .end(1);
        yaoDaiQianBaoData.setBeOverdue(overdue);
        //  信用卡 1.有信用卡 2.无信用卡  无
        Integer creditLimit = ChooseEq.create(apiDataExchangeParameter.getCreditLimit())
                .when("1", 2)
                .when("2", 1)
                .when("3", 1)
                .when("4", 1)
                .when("5", 1)
                .when("6", 1)
                .end(2);
        yaoDaiQianBaoData.setCreditCard(creditLimit);
        //  微粒贷额度 1.额度5000以下 2.额度5000-10000 3.额度10000-20000 4.额度20000以上 5.额度10000及以上
        yaoDaiQianBaoData.setMicroLoanQuota(0);
        //  教育程度 1.初中及以下 2.高中 3.中专 4.大专 5.本科 6.硕士 7.博士
        Integer educationAttainment = ChooseEq.create()
                .when(apiDataExchangeParameter.getEducationAttainment(), "1", 1)
                .when(apiDataExchangeParameter.getEducationAttainment(), "2", 3)
                .when(apiDataExchangeParameter.getEducationAttainment(), "3", 2)
                .when(apiDataExchangeParameter.getEducationAttainment(), "4", 4)
                .when(apiDataExchangeParameter.getEducationAttainment(), "5", 5)
                .when(apiDataExchangeParameter.getEducationAttainment(), "6", 6)
                .end(1);
        yaoDaiQianBaoData.setEducationLevel(educationAttainment);
        //  房产情况 1.有房可抵押 2.有房不抵押 3.无房产
        Integer house = ChooseEq.create()
                .when(apiDataExchangeParameter.getRealEstateInfo(), "1", 3)
                .when(apiDataExchangeParameter.getRealEstateInfo(), "2", 2)
                .when(apiDataExchangeParameter.getRealEstateInfo(), "3", 1)
                .when(apiDataExchangeParameter.getRealEstateInfo(), "4", 2)
                .when(apiDataExchangeParameter.getRealEstateInfo(), "5", 2)
                .when(apiDataExchangeParameter.getRealEstateInfo(), "6", 2)
                .end(3);
        yaoDaiQianBaoData.setHouseLevel(house);
        //  车产情况 1.有车可抵押 2.有车不抵押 3.无车产
        Integer car = ChooseEq.create()
                .when(apiDataExchangeParameter.getCarInfo(), "1", 3)
                .when(apiDataExchangeParameter.getCarInfo(), "2", 2)
                .when(apiDataExchangeParameter.getCarInfo(), "3", 1)
                .when(apiDataExchangeParameter.getCarInfo(), "4", 1)
                .end(3);
        yaoDaiQianBaoData.setVehicleLevel(car);
        //  公积金情况 1.连续缴纳6个月及以上 2.缴纳未满6个月 3.无公积金
        Integer gongjijin = ChooseEq.create()
                .when(apiDataExchangeParameter.getProvidentFund(), "1", 3)
                .when(apiDataExchangeParameter.getProvidentFund(), "2", 2)
                .when(apiDataExchangeParameter.getProvidentFund(), "3", 1)
                .when(apiDataExchangeParameter.getProvidentFund(), "4", 2)
                .end(3);
        yaoDaiQianBaoData.setAccumulationFundLevel(gongjijin);
        //  社保情况 1.连续缴纳6个月及以上 2.缴纳未满6个月 3.无社保
        Integer shebao = ChooseEq.create()
                .when(apiDataExchangeParameter.getSocialSecurity(), "1", 3)
                .when(apiDataExchangeParameter.getSocialSecurity(), "2", 2)
                .when(apiDataExchangeParameter.getSocialSecurity(), "3", 1)
                .when(apiDataExchangeParameter.getSocialSecurity(), "4", 2)
                .end(3);
        yaoDaiQianBaoData.setSocialSecurityLevel(shebao);
        //  保险 1.缴纳满一年 2.缴纳未满一年 3.无保单
        Integer baodanIs = ChooseEq.create()
                .when(apiDataExchangeParameter.getInsurancePolicy(), "1", 3)
                .when(apiDataExchangeParameter.getInsurancePolicy(), "2", 2)
                .when(apiDataExchangeParameter.getInsurancePolicy(), "3", 1)
                .when(apiDataExchangeParameter.getInsurancePolicy(), "4", 2)
                .end(3);
        yaoDaiQianBaoData.setInsure(baodanIs);
        //  职业 1.民企员工 2.外企员工 3.企业主 4.个体户 5.公务员 6.事业单位员工 7.国企员工 8.自由职业 9.其他
        Integer job = ChooseEq.create()
                .when(apiDataExchangeParameter.getCareer(), "1", 1)
                .when(apiDataExchangeParameter.getCareer(), "2", 8)
                .when(apiDataExchangeParameter.getCareer(), "3", 3)
                .when(apiDataExchangeParameter.getCareer(), "4", 5)
                .when(apiDataExchangeParameter.getCareer(), "5", 4)
                .end(1);
        yaoDaiQianBaoData.setOccupation(job);
        //  职业收入 1.月收入3500以下 2.月收入3500-6000 3.月收入6000-10000 4.月收入10000-20000 5.月收入20000以上
        Integer monthlySalary = ChooseEq.create()
                .when(apiDataExchangeParameter.getMonthlySalary(), "1", 1)
                .when(apiDataExchangeParameter.getMonthlySalary(), "2", 2)
                .when(apiDataExchangeParameter.getMonthlySalary(), "3", 3)
                .when(apiDataExchangeParameter.getMonthlySalary(), "4", 4)
                .when(apiDataExchangeParameter.getMonthlySalary(), "5", 5)
                .end(1);
        yaoDaiQianBaoData.setOccupationMonthlyIncome(monthlySalary);
        //  借款金额(元)
        Integer money = ChooseEq.create()
                .when(apiDataExchangeParameter.getLoanAmount(), "1", 30000)
                .when(apiDataExchangeParameter.getLoanAmount(), "2", 50000)
                .when(apiDataExchangeParameter.getLoanAmount(), "3", 100000)
                .when(apiDataExchangeParameter.getLoanAmount(), "4", 200000)
                .end(30000);
        yaoDaiQianBaoData.setLoanAmount(money);
        //  借款期限 1.借款3个月 2.借款6个月 3.借款9个月 4.借款12个月 5.借款24个月 loanTerm
        Integer loanTerm = ChooseEq.create()
                .when(apiDataExchangeParameter.getLoanTerm(), "1", 1)
                .when(apiDataExchangeParameter.getLoanTerm(), "2", 2)
                .when(apiDataExchangeParameter.getLoanTerm(), "3", 4)
                .when(apiDataExchangeParameter.getLoanTerm(), "4", 5)
                .when(apiDataExchangeParameter.getLoanTerm(), "5", 5)
                .when(apiDataExchangeParameter.getLoanTerm(), "6", 5)
                .end(1);
        yaoDaiQianBaoData.setLoanPeriod(loanTerm);
        //  城市
        yaoDaiQianBaoData.setCity(apiDataExchangeParameter.getCity());
        //  随机生成uid
        String uid = IdUtils.getSimpleUuid();
        //  加密
        AES aes = AES.createEcb(KEY.getBytes());
        String data = aes.encryptToBase64Str(JsonUtils.toJson(yaoDaiQianBaoData));
        Map<String, Object> map = MapUtils.newHashMap(newMap -> {
            newMap.put("accessKeyId", ACCESSKEY_ID);
            newMap.put("uid", uid);
            newMap.put("data", data);
        });
        return JsonUtils.toJson(map);
    }

    @Override
    public RespPlatformMultiPhoneMaskDataExchange respDataExchange(String respJson) throws Exception {
        JSONObject jsonObject = JsonUtils.get(respJson);
        if (jsonObject == null) {
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }
        if (!Eq.object(jsonObject.getInteger("code"), 200)) {
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }
        // 获取响应数据
        JSONObject resData = jsonObject.getJSONObject("data");
        if (ValidParam.isEmpty(resData)) {
            return RespPlatformMultiPhoneMaskDataExchange.ofFail();
        }

        RespPlatformMultiPhoneMaskDataExchange respPlatformMultiPhoneMaskDataExchange = RespPlatformMultiPhoneMaskDataExchange.ofSuc();
        List<RespPlatformPhoneMaskDataExchange> listRespPlatformPhoneMaskDataExchange = CollUtils.newArrayList();

        //  获取携带参数
        String orderId = resData.getString("cid");
        String productName = resData.getString("productName");
        String companyName = resData.getString("companyName");
        //  判断productName是否为空
        if(ValidParam.isEmpty(productName)){
            productName = "腰带钱包";
        }
        //  判断displayName是否为空
        if(ValidParam.isEmpty(companyName)){
            companyName = "广州萤火数字科技有限责任公司";
        }
        //  用户协议
        List<ApiProtocol> protocolList = new ArrayList<>();
        //  获取协议
        JSONArray listProtocolResult = resData.getJSONArray("protocol");
        IteratorUtils.array(listProtocolResult, (item, index) -> {
            JSONObject protocolObject = listProtocolResult.getJSONObject(index);
            ApiProtocol protocol = new ApiProtocol();
            protocol.setProtocolName(protocolObject.getString("protocolName"));
            protocol.setProtocolUrl(protocolObject.getString("protocolUrl"));
            protocolList.add(protocol);
        });
        //  获取手机号掩码
        List<String> listPhoneMd5 = new ArrayList<>();
        JSONArray jsonArray = resData.getJSONArray("md5List");
        IteratorUtils.array(jsonArray, (item, index) -> {
            String phoneMd5  = jsonArray.getString(index);
            listPhoneMd5.add(phoneMd5);
        });

        RespPlatformPhoneMaskDataExchange result = RespPlatformPhoneMaskDataExchange.of();

        result.setApplyId(orderId);
        result.setProductName(productName);
        result.setProtocolList(protocolList);
        result.setListPhoneMd5(listPhoneMd5);
        result.setDisplayName(companyName);
        listRespPlatformPhoneMaskDataExchange.add(result);

        respPlatformMultiPhoneMaskDataExchange.setListPhoneMask(listRespPlatformPhoneMaskDataExchange);
        return respPlatformMultiPhoneMaskDataExchange;
    }

    @Override
    public Object apply(ApiApplyParameter apiApplyParameter) throws Exception {
        //  创建对应进件实体类
        ApiPlatApplyYaoDaiQianBao yaoDaiQianBaoData = new ApiPlatApplyYaoDaiQianBao();
        yaoDaiQianBaoData.setName(apiApplyParameter.getUserName());
        //  订单编号
        yaoDaiQianBaoData.setCid(apiApplyParameter.getApplyId());
        //  8位明文手机号,例13800000
        yaoDaiQianBaoData.setPhone(apiApplyParameter.getPhone());
        //  渠道推广code
        yaoDaiQianBaoData.setChannelPromotionCode(ACCESSKEY_ID);
        //  性别 1男 2女
        Integer sex = ChooseEq.create()
                .when(apiApplyParameter.getSex(), "1", 2)
                .when(apiApplyParameter.getSex(), "0", 1)
                .end(1);
        yaoDaiQianBaoData.setSex(sex);
        yaoDaiQianBaoData.setClientIp(apiApplyParameter.getIp());
        //  芝麻分额度 1.额度600分以下 2.额度600-650分 3.额度651-700分 4.额度700分以上
        Integer zhima = ChooseEq.create()
                .when(apiApplyParameter.getSesameCredit(), "1", 1)
                .when(apiApplyParameter.getSesameCredit(), "2", 2)
                .when(apiApplyParameter.getSesameCredit(), "3", 3)
                .when(apiApplyParameter.getSesameCredit(), "4", 4)
                .end(1);
        yaoDaiQianBaoData.setSesameSeedQuota(zhima);
        //  蚂蚁花呗额度 1.额度1000以下 2.额度1000-5000 3.额度5000-10000 4.额度10000以上 5.无
        Integer hbLimit = ChooseEq.create()
                .when(apiApplyParameter.getHbLimit(), "1", 5)
                .when(apiApplyParameter.getHbLimit(), "2", 1)
                .when(apiApplyParameter.getHbLimit(), "3", 3)
                .when(apiApplyParameter.getHbLimit(), "4", 4)
                .when(apiApplyParameter.getHbLimit(), "5", 4)
                .end(5);
        yaoDaiQianBaoData.setAntCreditPayQuota(hbLimit);
        //  京东白条额度 1.额度1000以下 2.额度1000-5000 3.额度5000-10000 4.额度10000以上 5.无
        Integer btLimit = ChooseEq.create()
                .when(apiApplyParameter.getBtLimit(), "1", 5)
                .when(apiApplyParameter.getBtLimit(), "2", 1)
                .when(apiApplyParameter.getBtLimit(), "3", 3)
                .when(apiApplyParameter.getBtLimit(), "4", 4)
                .when(apiApplyParameter.getBtLimit(), "5", 3)
                .end(5);
        yaoDaiQianBaoData.setJdBtQuota(btLimit);
        //  逾期 1.否 2.是
        Integer overdue = ChooseEq.create()
                .when(apiApplyParameter.getOverdue(), "1", 1)
                .when(apiApplyParameter.getOverdue(), "2", 2)
                .when(apiApplyParameter.getOverdue(), "3", 1)
                .end(1);
        yaoDaiQianBaoData.setBeOverdue(overdue);
        //  信用卡 1.有信用卡 2.无信用卡  无
        Integer creditLimit = ChooseEq.create(apiApplyParameter.getCreditLimit())
                .when("1", 2)
                .when("2", 1)
                .when("3", 1)
                .when("4", 1)
                .when("5", 1)
                .when("6", 1)
                .end(2);
        yaoDaiQianBaoData.setCreditCard(creditLimit);
        //  微粒贷额度 1.额度5000以下 2.额度5000-10000 3.额度10000-20000 4.额度20000以上 5.额度10000及以上
        yaoDaiQianBaoData.setMicroLoanQuota(0);
        //  教育程度 1.初中及以下 2.高中 3.中专 4.大专 5.本科 6.硕士 7.博士
        Integer educationAttainment = ChooseEq.create()
                .when(apiApplyParameter.getEducationAttainment(), "1", 1)
                .when(apiApplyParameter.getEducationAttainment(), "2", 3)
                .when(apiApplyParameter.getEducationAttainment(), "3", 2)
                .when(apiApplyParameter.getEducationAttainment(), "4", 4)
                .when(apiApplyParameter.getEducationAttainment(), "5", 5)
                .when(apiApplyParameter.getEducationAttainment(), "6", 6)
                .end(1);
        yaoDaiQianBaoData.setEducationLevel(educationAttainment);
        //  房产情况 1.有房可抵押 2.有房不抵押 3.无房产
        Integer house = ChooseEq.create()
                .when(apiApplyParameter.getRealEstateInfo(), "1", 3)
                .when(apiApplyParameter.getRealEstateInfo(), "2", 2)
                .when(apiApplyParameter.getRealEstateInfo(), "3", 1)
                .when(apiApplyParameter.getRealEstateInfo(), "4", 2)
                .when(apiApplyParameter.getRealEstateInfo(), "5", 2)
                .when(apiApplyParameter.getRealEstateInfo(), "6", 2)
                .end(3);
        yaoDaiQianBaoData.setHouseLevel(house);
        //  车产情况 1.有车可抵押 2.有车不抵押 3.无车产
        Integer car = ChooseEq.create()
                .when(apiApplyParameter.getCarInfo(), "1", 3)
                .when(apiApplyParameter.getCarInfo(), "2", 2)
                .when(apiApplyParameter.getCarInfo(), "3", 1)
                .when(apiApplyParameter.getCarInfo(), "4", 1)
                .end(3);
        yaoDaiQianBaoData.setVehicleLevel(car);
        //  公积金情况 1.连续缴纳6个月及以上 2.缴纳未满6个月 3.无公积金
        Integer gongjijin = ChooseEq.create()
                .when(apiApplyParameter.getProvidentFund(), "1", 3)
                .when(apiApplyParameter.getProvidentFund(), "2", 2)
                .when(apiApplyParameter.getProvidentFund(), "3", 1)
                .when(apiApplyParameter.getProvidentFund(), "4", 2)
                .end(3);
        yaoDaiQianBaoData.setAccumulationFundLevel(gongjijin);
        //  社保情况 1.连续缴纳6个月及以上 2.缴纳未满6个月 3.无社保
        Integer shebao = ChooseEq.create()
                .when(apiApplyParameter.getSocialSecurity(), "1", 3)
                .when(apiApplyParameter.getSocialSecurity(), "2", 2)
                .when(apiApplyParameter.getSocialSecurity(), "3", 1)
                .when(apiApplyParameter.getSocialSecurity(), "4", 2)
                .end(3);
        yaoDaiQianBaoData.setSocialSecurityLevel(shebao);
        //  保险 1.缴纳满一年 2.缴纳未满一年 3.无保单
        Integer baodanIs = ChooseEq.create()
                .when(apiApplyParameter.getInsurancePolicy(), "1", 3)
                .when(apiApplyParameter.getInsurancePolicy(), "2", 2)
                .when(apiApplyParameter.getInsurancePolicy(), "3", 1)
                .when(apiApplyParameter.getInsurancePolicy(), "4", 2)
                .end(3);
        yaoDaiQianBaoData.setInsure(baodanIs);
        //  职业 1.民企员工 2.外企员工 3.企业主 4.个体户 5.公务员 6.事业单位员工 7.国企员工 8.自由职业 9.其他
        Integer job = ChooseEq.create()
                .when(apiApplyParameter.getCareer(), "1", 1)
                .when(apiApplyParameter.getCareer(), "2", 8)
                .when(apiApplyParameter.getCareer(), "3", 3)
                .when(apiApplyParameter.getCareer(), "4", 5)
                .when(apiApplyParameter.getCareer(), "5", 4)
                .end(1);
        yaoDaiQianBaoData.setOccupation(job);
        //  职业收入 1.月收入3500以下 2.月收入3500-6000 3.月收入6000-10000 4.月收入10000-20000 5.月收入20000以上
        Integer monthlySalary = ChooseEq.create()
                .when(apiApplyParameter.getMonthlySalary(), "1", 1)
                .when(apiApplyParameter.getMonthlySalary(), "2", 2)
                .when(apiApplyParameter.getMonthlySalary(), "3", 3)
                .when(apiApplyParameter.getMonthlySalary(), "4", 4)
                .when(apiApplyParameter.getMonthlySalary(), "5", 5)
                .end(1);
        yaoDaiQianBaoData.setOccupationMonthlyIncome(monthlySalary);
        //  借款金额(元)
        Integer money = ChooseEq.create()
                .when(apiApplyParameter.getLoanAmount(), "1", 30000)
                .when(apiApplyParameter.getLoanAmount(), "2", 50000)
                .when(apiApplyParameter.getLoanAmount(), "3", 100000)
                .when(apiApplyParameter.getLoanAmount(), "4", 200000)
                .end(30000);
        yaoDaiQianBaoData.setLoanAmount(money);
        //  借款期限 1.借款3个月 2.借款6个月 3.借款9个月 4.借款12个月 5.借款24个月 loanTerm
        Integer loanTerm = ChooseEq.create()
                .when(apiApplyParameter.getLoanTerm(), "1", 1)
                .when(apiApplyParameter.getLoanTerm(), "2", 2)
                .when(apiApplyParameter.getLoanTerm(), "3", 4)
                .when(apiApplyParameter.getLoanTerm(), "4", 5)
                .when(apiApplyParameter.getLoanTerm(), "5", 5)
                .when(apiApplyParameter.getLoanTerm(), "6", 5)
                .end(1);
        yaoDaiQianBaoData.setLoanPeriod(loanTerm);
        //  城市
        yaoDaiQianBaoData.setCity(apiApplyParameter.getCity());
        //  年龄
        yaoDaiQianBaoData.setAge(Integer.valueOf(apiApplyParameter.getAge()));
        //  随机生成uid
        String uid = IdUtils.getSimpleUuid();
        //  加密
        AES aes = AES.createEcb(KEY.getBytes());
        String data = aes.encryptToBase64Str(JsonUtils.toJson(yaoDaiQianBaoData));
        Map<String, Object> map = MapUtils.newHashMap(newMap -> {
            newMap.put("accessKeyId", ACCESSKEY_ID);
            newMap.put("uid", uid);
            newMap.put("data", data);
        });
        return JsonUtils.toJson(map);
    }

    @Override
    public RespPlatformPhoneMaskApply respApply(String respJson) throws Exception {
        JSONObject jsonObject = JsonUtils.get(respJson);
        if (jsonObject == null) {
            return RespPlatformPhoneMaskApply.ofFail();
        }
        if (!Eq.object(jsonObject.getInteger("code"), 200)) {
            return RespPlatformPhoneMaskApply.ofFail();
        }
        return RespPlatformPhoneMaskApply.ofSuc();
    }


    @Override
    public RespPlatformNoticeApply parseApplyNotice(RequestVO requestVO) {
        return null;
    }

    @Override
    public Map<String, Object> respApplyNotice(ApiBizStatus apiBizStatus) {
        return Map.of();
    }
}
